package com.huawei.esdk.tp.domain.model;

import java.util.List;
import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.platform.common.exception.SDKException;
import com.huawei.esdk.platform.common.utils.ApplicationContextUtil;
import com.huawei.esdk.platform.nemgr.itf.IDeviceManager;
import com.huawei.esdk.tp.common.constants.TPConstant;
import com.huawei.esdk.tp.device.smc.v100r003c10.SMC20V1R3C10IOrgaManagerCapability;
import com.huawei.esdk.tp.domain.model.bean.OrganizationItem;

public class Organization
{
    private static IDeviceManager deviceManager = (IDeviceManager)ApplicationContextUtil
        .getBean("deviceManager");
    
    public static IDeviceManager getDeviceManager()
    {
        return deviceManager;
    }
    
    public SDKResult<List<OrganizationItem>> queryOrganizationEx() throws SDKException
    {
        SMC20V1R3C10IOrgaManagerCapability orgaMgr =
            getDeviceManager().getDeviceServiceProxy(TPConstant.DEV_ID_SMC,
                SMC20V1R3C10IOrgaManagerCapability.class);
        
        SDKResult<List<OrganizationItem>> result = orgaMgr.queryOrganization();
        
        return result;
    }
}
